#pragma once
#include "Binding/BoundBlock.hpp"
#include "Binding/BoundTreeRewriter.hpp"

#include "Binding/BoundLabel.hpp"
#include <cstddef>
class Lowerer : public BoundTreeRewriter
{
private:
    size_t LableCount;

public:
    Lowerer() : LableCount(0){};
    ~Lowerer() = default;

    SharedBoundLabel GenerateLabel();

public:
    static SharedBoundBlockStatement Lower(SharedBoundStatement statement);
    static SharedBoundBlockStatement Flatten(SharedBoundStatement statement);

protected:
    SharedBoundStatement RewriteForStatement(SharedBoundStatement node) override;
    SharedBoundStatement RewriteIfStatement(SharedBoundStatement node) override;
    SharedBoundStatement RewriteWhileStatement(SharedBoundStatement node) override;
};